package leetcode.editor.cn;

/**
 * @author: yangwk
 * @date: 2023/10/19
 * @description:
 **/
public class P483 {
    public static void main(String[] args) {
        System.out.println(findMaxConsecutiveOnes(new int[]{1,1,0,1,1,1}));
    }
    public static int findMaxConsecutiveOnes(int[] nums) {
        int max = 0, right = 0, left = 0;
        while (right < nums.length) {
            if (nums[right] == 1) {
                right++;
                continue;
            }else{
                max = Math.max(right - left, max);
                right++;
                left = right;
            }
        }
        max = Math.max(right - left, max);
        return max;
    }
}
